-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retry send_tx on account sequence mismatch #1349
Conversation
Yes, you can test it out with a two raw tx transfers using the same wallet as the relayer. In the log you should see the relayer refetch the account sequence when the first attempt failed.
|
FYI --
|
I tried to summarize the status of the issue in here #1397. The solution in the present PR is incomplete, and we'll deprioritize this until we investigate further on the tm-go side. In the meantim, let's close this PR. We'll reuse some of the code later if it proves useful. Let's keep the branch around! |
@adizere - thanks for your work on this! We're running this branch on a public testnet and it has been avoiding the account sequence deadlock that we were seeing on v0.9.0 so far. On
It was un-resolvable without restarting the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got positive feedback from 2 relayer operators, still waiting on 1 of them. Specifically, the feedback is that this PR seems to alleviate the problem of needing to restart Hermes when acct. seq. mismatch occurs. I will merge this within the day, unless a relayer operator highlights any issue.
* Retry send_tx on account sequence mismatch * Move MAX_ACCOUNT_SEQUENCE_RETRY to retry_strategy module * Introduce INCORRECT_ACCOUNT_SEQUENCE_ERR constant for error code 32 * Inline constant matching * Retry on simulation failure * Refactored retry to catch both estimate and bcast errors * Fixed off-by-one error in re-fetching logic * Basic backoff mechanism * More idiomatic account seq. incremental * Adapted to catch acct.seq more generally * retry counter logging * Bumped the multipler from 100 to 200 * Non-retrying fix upon gas estimation failure * Adjusted retry params; added ref. to informalsystems#1153. * changelog Co-authored-by: Adi Seredinschi <[email protected]>
Closes: #1264
Description
This PR makes Hermes retry on
send_tx
for up to 5 times, in the event that the submission failed with aincorrect account sequence
error. This error can occur either at the gas estimation step (send_tx_simulate
), or at the transaction submission step (broadcast_tx_sync
). In both cases, we parse the error message to match on its details and infer if it is account sequence mismatch.For the case when the error appears at the gas estimation step, we match on the "account sequence mismatch" status message. We do not retry in the runtime, but rather at the worker level (
step
function).For the case when the account sequence mismatch occurs at transaction submission step, we detect the error by checking for the error code 32 defined in Cosmos SDK, and then perform the retry accordingly directly in the runtime.
For contributor use:
unclog
.docs/
) and code comments.Files changed
in the Github PR explorer.